package com.digital.smartgrow.service.process.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.digital.smartgrow.dto.process.UpProcessItemPageDTO;
import com.digital.smartgrow.entity.process.UpProcessItem;
import com.digital.smartgrow.dao.process.UpProcessItemMapper;
import com.digital.smartgrow.service.process.UpProcessItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 审批流节点
 服务实现类
 * </p>
 *
 * @author sunyuechao
 * @since 2022-07-12
 */
@Service
public class UpProcessItemServiceImpl extends ServiceImpl<UpProcessItemMapper, UpProcessItem> implements UpProcessItemService {

    @Override
    public Object getListByPage(UpProcessItemPageDTO pageDTO) {
        Page<UpProcessItem> page = new Page<>(pageDTO.getPageNum(), pageDTO.getPageSize());
        QueryWrapper<UpProcessItem> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(StringUtils.isNotBlank(pageDTO.getSuperCode()+""), "superCode", pageDTO.getSuperCode());
        queryWrapper.like(StringUtils.isNotBlank(pageDTO.getName()), "name", pageDTO.getName());
        return this.page(page, queryWrapper);

    }

    @Override
    public UpProcessItem getInfo(Integer id) {
        return this.getById(id);
    }
}
